package top.wshape1.rpc.filter;

import lombok.extern.slf4j.Slf4j;
import top.wshape1.rpc.common.exception.RpcException;
import top.wshape1.rpc.message.RpcMessage;

/**
 * @author Wshape1
 * @version 1.0
 * @description log filter
 * @since 2024-02-15
 */

@Slf4j
public class LogFilter implements Filter {
    @Override
    public int getOrder() {
        return HIGHEST_PRECEDENCE + 1;
    }

    @Override
    public boolean doFilter(RpcMessage message, FilterChain filterChain) throws RpcException {
        log.info("RpcMessage: {}", message.toString());
        return filterChain.doFilter(message);
    }
}
